﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Netra
{
    partial class PlanetInfo : Control
    {
        private Planet planet;

        public class SellWare
        {
            public string Name {get;set;}
            public int Quantity {get;set;}
            public int Price {get;set;}
            public int Production { get; set; }
        }

        public class BuyWare
        {
            public string Name { get; set; }
            public int Quantity { get; set; }
            public int Price { get; set; }
            public int Consumption { get; set; }
        }

        public List<SellWare> sell_wares;

        public PlanetInfo(Planet _planet)
        {
            planet = _planet;


            InitializeComponent();

            label1.Text = planet.Name;

            sell_wares=new List<SellWare>();

            List<Merch> offered = planet.store.OfferedWares();
            foreach (Merch ware in offered)
            {
                var row_val = new SellWare();
                row_val.Name=ware.Name;
                row_val.Quantity=planet.store.MaxSellQuantity(ware);
                row_val.Price=planet.store.SellPrice(ware);
                row_val.Production=planet.store.Production(ware);
                sellWareBindingSource.Add(row_val);
            }


            List<Merch> purchased = planet.store.PurchasedWares();
            foreach (Merch ware in purchased)
            {
                var row_val = new BuyWare();
                row_val.Name=ware.Name;
                row_val.Quantity=planet.store.MaxBuyQuantity(ware);
                row_val.Price=planet.store.BuyPrice(ware);
                row_val.Consumption=planet.store.Consumption(ware);
                buyWareBindingSource.Add(row_val);
            }

        }

        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}
